package com.framework.service.yhbservice.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.dao.YHBDao.indexDao.YhbOrAppAdvDao;
import com.framework.service.yhbservice.YhbOrAppAdvService;
import com.framework.service.yhbservice.YhbUserService;
import com.framework.yhbEntity.Index.YhbOrAppAdv;
import com.framework.yhbEntity.user.YhbUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("yhbOrAppAdvService")
public class YhbOrAppAdvServiceImpl extends ServiceImpl<YhbOrAppAdvDao, YhbOrAppAdv> implements YhbOrAppAdvService {
    @Autowired
    private YhbUserService yhbUserService;


    @Override
    public List<YhbOrAppAdv> getIndexAdv(String token) {
        YhbUser user = yhbUserService.queryUserByToken(token);
        List<YhbOrAppAdv> list = baseMapper.selectList(new EntityWrapper<YhbOrAppAdv>()
                .eq("dept_id", user.getDeptId()).eq("is_show",1)
        );
        return list;
    }
}
